home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-09-22 | 1.2 KB | 36 lines | [TEXT/GEOL] |
- Item 2919378 21-Sept-89 23:52
-
- From: MUYSVASOVIC1 ER&D - J-D Muys-Vasovic
-
- To: MACAPP.TECH$ MACAPP Tech
-
- Sub: Re: Re: IDType vs item number
-
- In that case what I would do personally is to assign consecutives IDs for all
- the radios, say 'rad1', 'rad2', ..., 'radX', and then use the ids as an index
- into my array, declared as (if you have 8 radio buttons):
-
- VAR myArray: ARRAY['rad1' .. 'rad8'] of TWhatever;
-
- The key here is to remember that Pascal allows you to specify the lower bound
- of an array (without wasting space of course). This is maybe a little too
- forgotten in those "C" days...
-
- There is a small problem though: 'rad1' is of type OSType, ie PACKED
- ARRAY[1..4] of CHAR, ie NOT longint. Therefore, the declaration above is
- illegal. After trying several solutions, the only working way to circumvent the
- type checking of the compiler is to write something like that:
-
- const
- low = ((ord('r') * 256 + ord('a')) * 256 + ord('d')) * 256 + 1;
- up = ((ord('r') * 256 + ord('a')) * 256 + ord('d')) * 256 + 8;
- var
- a: ARRAY[low..up] of longint;
-
- to access the array, you would write a[longint('rad1')] for example.
-
- hope that helps!!
-
- Jean-Denis
-
-